﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace LibFriesland_Campina_CRM
{
    public class BizInvoice
    {
        #region Thuoc tinh
        public long invoice_numid { get; set; }
        public DateTime datetime_invoice { get; set; }
        public DateTime? datetime_phone_invoice { get; set; }
        public string by_na { get; set; }
        public string by_shop { get; set; }
        public long by_shopper { get; set; }
        public string session_invoice { get; set; }
        #endregion

        #region Ham thiet lap
        public BizInvoice(long pInvoice_numid, DateTime pDatetime_invoice, DateTime? pDatetime_phone_invoice, string pBy_na, string pBy_shop, int pBy_shopper, string pSession_invoice)
        {
            invoice_numid = pInvoice_numid;
            datetime_invoice = pDatetime_invoice;
            datetime_phone_invoice = pDatetime_phone_invoice;
            by_na = pBy_na;
            by_shop = pBy_shop;
            by_shopper = pBy_shopper;
            session_invoice = pSession_invoice;
        }
        #endregion

        #region Phuong thuc
        //Lay invoice_numid cua Invoice theo Sesssion
        public static long getInvoiceNumID(string pSession_invoice)
        {
            return DalInvoice.getInvoiceNumID(pSession_invoice);
        }
        
        //Lay InvoiceDetail cua Invoice
        public static List<BizInvoiceDetail> getInvoiceDetailbyInvoice(long pInvoice_numid)
        {
            return DalInvoice.getInvoiceDetailbyInvoice(pInvoice_numid);
        }

        //Them mot Invoice moi
        public long addInvoice()
        {
            return DalInvoice.addInvoice(this);
        }
        
        //Xoa mot Invoice
        public static int deleteInvoice(long pInvoice_numid)
        {
            return DalInvoice.deleteInvoice(pInvoice_numid);
        }
        #endregion

        #region Dung cho Webservice
        //Them invoice cho Shopper moi
        public static int addInvoicebyShopper(BizShopper pShopper, BizNA pNA, BizInvoice pInvoice, BizInvoiceDetail pInvoiceDetail)
        {
            return DalInvoice.addInvoicebyShopper(pShopper, pNA, pInvoice, pInvoiceDetail);
        }

        //Them Invoice cho Shopper moi
        public static int addInvoicebyShopper(BizShopper pShopper, BizRelatives pRelatives, BizNA pNA, BizInvoice pInvoice, BizInvoiceDetail pInvoiceDetail)
        {
            return DalInvoice.addInvoicebyShopper(pShopper, pRelatives, pNA, pInvoice, pInvoiceDetail);
        }
        #endregion
    }
}
